n = int(input())
scores = []
for _ in range(n):
    score = int(input())
    scores.append(score)

print(max(scores))
print(min(scores))